package com.dmlll.controller;


import com.dmlll.VO.ZjyangDTOzjy;
import com.dmlll.VO.ZjyangVO;
import com.dmlll.domain.DrugCategory;
import com.dmlll.service.DrugCategoryService;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;


import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author dmLll
 * @since 2021-03-31
 */
@RestController
public class DrugCategoryController {

    @Autowired
    private DrugCategoryService drugCategoryService;

    @RequestMapping("/selectCategory")
    @ResponseBody
    public List<DrugCategory> selectCategory(){
        return drugCategoryService.selectCategory();
    }

    @RequestMapping("/getDrugCategory")
    public List<DrugCategory> getDrugCategory(){
        List<DrugCategory> list = drugCategoryService.list();
        return list;
    }
    @RequestMapping("/getDrugCategoryById")
    public DrugCategory getDrugCategoryById(Integer drugCategoryId){
        return drugCategoryService.getById(drugCategoryId);
    }
    @RequestMapping("/PageInfoZjyangVO")
    @ResponseBody
    public PageInfo <ZjyangVO> zjyangVO(ZjyangDTOzjy zjyangDTOzjy, @RequestParam(name ="pageNum" ,defaultValue = "1",required = false) Integer pageNum, @RequestParam(name="pageSize",defaultValue = "4") Integer pageSize){
        PageInfo<ZjyangVO> list=drugCategoryService.zjyangVO(zjyangDTOzjy,pageNum,pageSize);
        return list;
    }
}



